﻿//
// *************************************************************************************
// WP-Framework
//
// Developed by 
// Lukas Kretschmar (lkretschmar.dev@bluewin.ch)
//
// Switzerland, Copyright (c) 2012 lkretschmar
// This content is released under the MIT License (http://opensource.org/licenses/MIT).
//     
// *************************************************************************************
//
//



namespace KretschIT.WP_Fx.EasyMoq.Conditions
{
    internal class Between : ICondition
    {
        private int lowerBound;
        private int upperBound;

        #region  Ctor

        public Between(int lowerBound, int upperBound)
        {
            this.lowerBound = lowerBound;
            this.upperBound = upperBound;
        }

        #endregion

        public bool CanBeVerifiedWith(int count)
        {
            return this.IsHigherOrEqual(count) && this.IsLowerOrEqual(count);
        }

        private bool IsHigherOrEqual(int count)
        {
            return count >= this.lowerBound;
        }
        
        private bool IsLowerOrEqual(int count)
        {
            return count <= this.upperBound;
        }

        public string GetFailureMessage(int count)
        {
            return string.Format("Expected count between {0} and {1} calls - had {2}.", this.lowerBound, this.upperBound, count);
        }
    }
}
